#!/usr/bin/python

import urllib
import sys

fp = urllib.urlopen(sys.argv[1])
op = open("test.txt", "wb")
n = 0

while 1:
	s = fp.read(1024)
	if not s:
		break
	op.write(s)
	n = n + len(s)
op.close()

for k, v in fp.headers.items():
	print k,":",v

print n," bytes copied from ", fp.url
fp.close()